import hashlib
import json
from handle.logger import logger
from handle.S2Redis import sync_data_background,render_template,redis_client,socketio
from handle.auth import *
from redis import *

def format_user_table(pipeline):
    new_user_table={}
    for user in get_user_cache():
        s=user['UserName']+user['Password']
        new_user_table[str(hashlib.md5(s.encode()).hexdigest())]=user
    # 写入redis
    pipeline.set("user",str(new_user_table).replace("'",'"'))
    pipeline.execute()